package com.tjetc.model;

public class PlanResponse {
    private boolean success;
    private String message;
    private Object data;

    public PlanResponse(boolean success, String message, Object data) {
        this.success = success;
        this.message = message;
        this.data = data;
    }

    // 快速创建成功响应的静态方法
    public static PlanResponse success(String message, Object data) {
        return new PlanResponse(true, message, data);
    }

    // 快速创建失败响应的静态方法
    public static PlanResponse fail(String message) {
        return new PlanResponse(false, message, null);
    }

    // 添加这个新方法 - 从ChatResponse中提取内容并创建PlanResponse
    public static PlanResponse fromChatResponse(ChatResponse chatResponse) {
        if (chatResponse != null && chatResponse.getResult() != null &&
                chatResponse.getResult().getOutput() != null) {
            String content = chatResponse.getResult().getOutput().getContent();
            return PlanResponse.success("旅行计划生成成功", content);
        } else {
            return PlanResponse.fail("生成旅行计划失败");
        }
    }

    // getters 和 setters
    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}